home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyc (Python 2.6)
-
- '''
- SimpleGladeApp.py
- Module that provides an object oriented abstraction to pygtk and gtkbuilder
- Copyright (C) 2009 Michael Vogt
- based on ideas from SimpleGladeBuilder by Sandino Flores Moreno
- '''
- import os
- import sys
- import re
- import gtk
-
- class SimpleGtkbuilderApp:
-
- def __init__(self, path, domain):
- self.builder = gtk.Builder()
- self.builder.set_translation_domain(domain)
- self.builder.add_from_file(path)
- self.builder.connect_signals(self)
- for o in self.builder.get_objects():
- if issubclass(type(o), gtk.Buildable):
- name = gtk.Buildable.get_name(o)
- setattr(self, name, o)
- continue
- print >>sys.stderr, "WARNING: can not get name for '%s'" % o
-
-
-
- def run(self):
- '''
- Starts the main loop of processing events checking for Control-C.
-
- The default implementation checks wheter a Control-C is pressed,
- then calls on_keyboard_interrupt().
-
- Use this method for starting programs.
- '''
-
- try:
- gtk.main()
- except KeyboardInterrupt:
- self.on_keyboard_interrupt()
-
-
-
- def on_keyboard_interrupt(self):
- '''
- This method is called by the default implementation of run()
- after a program is finished by pressing Control-C.
- '''
- pass
-
-
-